package vip.george.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.george.common.dto.ResultVO;
import vip.george.order.dto.request.GeneraOrderRequest;
import vip.george.order.service.OrderService;

import javax.validation.Valid;

/**
 * @author george
 * @since 2023/7/5
 * <p>订单controller</p>
 */
@RestController
@RequestMapping("/order")
public class OrderController {


    @Autowired
    private OrderService orderService;


    /**
     * 创建一个订单
     */
    @PostMapping("/generateOrder")
    public ResultVO<Boolean> generateOrder(@RequestBody @Valid GeneraOrderRequest request) {
        Boolean result = orderService.generateOrder(request);
        return ResultVO.success(result);
    }


}
